import request from "utils/request";

// 获取文章列表
export const getArticleList=(params)=>{
    return request({
        url:"/v1_0/mp/articles",
        params
    })
}

// 删除文章
export const deleteArticleList=(id)=>{
    return request({
        url:`/v1_0/mp/articles/${id}`,
        method:"delete"
    })
}

// 发布文章
export const submitArticle=(data,draft=false)=>{
    return request({
        url:`/v1_0/mp/articles?draft=${draft}`,
        method:"post",
        data
    })
}

// 编辑文章
export const submitWriteArticle=(data,draft=false)=>{
    return request({
        url:`/v1_0/mp/articles/${data.id}?draft=${draft}`,
        method:"put",
        data
    })
}

// 获取文章详情
export const getArticleDetail=(id)=>{
    return request({
        url:`/v1_0/mp/articles/${id}`
    })
}